﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pardusshipcalc
{
    class CrewClass
    {
        public static void Initialize()
        {
        }
        /* { 0: primary abl, 1: secondary abl, 2: sign-up-free, 3: pay/day} */
        int[,] crewData = {
                                   {-1, -1, -1,-1}, /* none */
                                   {5,2,15000000,500000}, /* 1: Donna Ortega */
                                   {6,10,12500000,450000}, /* 2: Kurt Radon */
                                   {8,9,8000000,250000}, /* Anna Tarasov */
                                   {4,3,6000000,400000}, /* Frederik Ownsworth */
                                   {1,4,2000000,300000}, /* Silvia Grey */
                                   {0,2,16000000,650000}, /* Qyopp Nrkzatxyx */
                                   {10,5,10000000,350000}, /* Nshrrah*/
                                   {6,8,8000000,450000}, /* Hizzv */
                                   {8,1,5000000,400000}, /* Grtkxa */
                                   {1,9,2000000,300000}, /* Xkrt */
                                   {3,7,16000000,550000}, /* Peknana */
                                   {4,6,14000000,400000}, /* Jenk*/
                                   {7,11,12000000,600000}, /* Hond*/
                                   {5,0,10000000,700000}, /*Keldrana*/
                                   {0,9,3000000,450000}, /*uco*/
                                   {3,2,16000000,700000}, /*Na Sonkq*/
                                   {5,11,16000000,450000}, /* sebonk */
                                   {0,1,15000000,500000}, /* Norr */
                                   {8,2,8000000,600000}, /* Shrozz */
                                   {2,9,60000000,500000}, /* Zazxana */
                                   {2,10,5000000,500000}, /* Rendnora */
                                   {8,4,3000000,600000}, /* Tarra */                                   
                               };

        public int GetLegCrewData(int mode, int legendaryComboSelectedIndex)
        {
            int returnData = 0;

            returnData = crewData[legendaryComboSelectedIndex, mode];

            return returnData;
        }

        public string convertAbilityValueToString(int abilityValue)
        {
            switch (abilityValue)
            {
                case -1:
                    return "N/A";

                case 0:
                    return "Navigator";

                case 1:
                    return "Gatherer";

                case 2:
                    return "Tactician";

                case 3:
                    return "Internal Engineer";

                case 4:
                    return "Hacker";

                case 5:
                    return "Pathfinder";

                case 6:
                    return "Doctor";

                case 7:
                    return "External Engineer";

                case 8:
                    return "Venturer";

                case 9:
                    return "Lobbyist";

                case 10:
                    return "Patriot";

                case 11:
                    return "Loyalist";
            }
            return "ERR";
        }

        public string convertAbilityValueToDescription(int abilityValue)
        {
            switch (abilityValue)
            {
                case -1:
                    return "N/A";

                case 0:
                    return "Adds bonus to the captain's maneuver skill";

                case 1:
                    return "Adds bonus to all the captain's collecting skills";

                case 2:
                    return "Adds bonus to the captain's tactics and hit accuracy skills";

                case 3:
                    return "Adds bonus to the captain's engineering and weaponry skills";

                case 4:
                    return "Adds bonus to the captain's hacking and cloaking skills";

                case 5:
                    return "Movement cost on all field types except normal space is reduced by bonus";

                case 6:
                    return "When taking drugs, chance per drug to have an effect on dimishing APs is reduced by bonus";

                case 7:
                    return "External Repairs bonus damaged armor points every hour";

                case 8:
                    return "Increases experience points gained from killing NPC opponents by bonus";

                case 9:
                    return "Reduces the loss of rank or competency from failed bulletin board missions by bonus";

                case 10:
                    return "Reduces sign-up fee and pay by bonus, if player has the same race (cumulative with the natural race bonus of 20%)";

                case 11:
                    return "Serves for bonus more days";
            }
            return "ERR";
        }

        public string convertAbilityValueToBonus(int abilityValue, bool secondary, bool withDescription)
        {
            double retVal = 0;
            string positive = "";
            switch (abilityValue)
            {
                case -1:
                    return "N/A";

                case 0:
                    retVal = 0.5;
                    break;

                case 1:
                    retVal = 0.3;
                    break;

                case 2:
                    retVal = 0.3;
                    break;

                case 3:
                    retVal = 0.3;
                    break;

                case 4:
                    retVal = 0.3;
                    break;

                case 5:
                    retVal = -0.3;
                    break;

                case 6:
                    retVal = -0.5;
                    break;

                case 7:
                    retVal = 300;
                    break;

                case 8:
                    retVal = 0.5;
                    break;

                case 9:
                    retVal = -0.5;
                    break;

                case 10:
                    retVal = -0.5;
                    break;

                case 11:
                    retVal = 2;
                    break;
            }

            if (secondary == true)
            {
                retVal = (retVal / 2);
            }
            if (retVal > 0)
            {
                positive = "+";
            }            

            if ((retVal != 300) && (retVal != 150))
            {
                if (withDescription == true)
                {
                    return positive + retVal.ToString("P0") + convertAbilityValueToShortDescription(abilityValue);
                }
                else
                {
                    return positive + retVal.ToString("P0");
                }
            }
            else
            {
                if (withDescription == true)
                {
                    return positive + retVal.ToString("N0") + convertAbilityValueToShortDescription(abilityValue);
                }
                else
                {
                    return positive + retVal.ToString("N0");
                }
            }
        }

        public double convertAbilityValueToBonusValue(int abilityValue, bool secondary)
        {
            double retVal = 0;
            switch (abilityValue)
            {
                case -1:
                    return -1;

                case 0:
                    retVal = 0.5;
                    break;

                case 1:
                    retVal = 0.3;
                    break;

                case 2:
                    retVal = 0.3;
                    break;

                case 3:
                    retVal = 0.3;
                    break;

                case 4:
                    retVal = 0.3;
                    break;

                case 5:
                    retVal = -0.3;
                    break;

                case 6:
                    retVal = -0.5;
                    break;

                case 7:
                    retVal = 300;
                    break;

                case 8:
                    retVal = 0.5;
                    break;

                case 9:
                    retVal = -0.5;
                    break;

                case 10:
                    retVal = -0.5;
                    break;

                case 11:
                    retVal = 2;
                    break;
            }

            if (secondary == true)
            {
                retVal = (retVal / 2);
            }

                    return retVal;
          
        }

        public string convertAbilityValueToShortDescription(int abilityValue)
        {
            switch (abilityValue)
            {
                case -1:
                    return "";

                case 0:
                    return " MAN";

                case 1:
                    return " Collecting Skills";

                case 2:
                    return " TAC & HA";

                case 3:
                    return " ENG & WEAP";

                case 4:
                    return " Hack & Cloak";

                case 5:
                    return " Movement Cost";

                case 6:
                    return " Overdrugging";

                case 7:
                    return " Armor Per Hour";

                case 8:
                    return " XP per NPC kill";

                case 9:
                    return " Rank loss for failure";

                case 10:
                    return " Cost for same race";

                case 11:
                    return " Service time";
            }

            return "ERR";
        }

        public string convertLegendaryNameToSubtitle(int legendaryComboBoxSelectedIndex)
        {
            switch (legendaryComboBoxSelectedIndex)
            {
                case -1:
                    return "N/A";

                case 0:
                    return "N/A";

                case 1:
                    return "The Ultimate Observer";

                case 2:
                    return "The Nutty Professor";

                case 3:
                    return "The Affiliated Operator";

                case 4:
                    return "The Guru Meditator";

                case 5:
                    return "The Cyberminer";

                case 6:
                    return "The Starmaster";

                case 7:
                    return "The Proud Spacefarer";

                case 8:
                    return "The Keeper of Candy";

                case 9:
                    return "The Incorrigible Adventurer";

                case 10:
                    return "The Hellbent Collector";

                case 11:
                    return "The Phenomenal Gadgeteer";

                case 12:
                    return "The Data Doc";

                case 13:
                    return "The Truehearted Cybernaut";

                case 14:
                    return "The Starscout";

                case 15:
                    return "Chief Navigator of the Globbs";

                case 16:
                    return "The Amazing Mastermind";

                case 17:
                    return "The Pathkeeper";

                case 18:
                    return "The Unforsaken Voyager";

                case 19:
                    return "The Beast Gambler";

                case 20:
                    return "The Cunning Observer";

                case 21:
                    return "The Tharkull Warlady";

                case 22:
                    return "The Henchwoman";
            }
            return "ERR";
        }

        public string convertLegendaryNameToRespectedStatus(int legendaryComboBoxSelectedIndex)
        {
            switch (legendaryComboBoxSelectedIndex)
            {
                case 0:
                case -1:
                    return "N/A";

                case 1:
                case 3:
                case 6:
                case 7:
                case 9:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 16:
                case 18:
                case 19:
                case 20:
                    return "Neutral";

                case 2:
                case 10:
                case 17:
                case 21:
                    return "Respected";

                case 4:
                case 5:
                case 8:
                case 22:
                    return "Despised";

            }
            return "ERR";
        }

    }
}
